package com.sl.core.engine.thread;

import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Maps;

import java.util.Map;

public class ThreadConfig {

    public static ThreadConfig INSTANCE = new ThreadConfig();

    private Map<String, TraceThreadPoolTaskExecutor> traceThreadPoolTaskExecutorMap = Maps.newConcurrentMap();

    public TraceThreadPoolTaskExecutor get(String code) {
        if(StrUtil.isBlank(code)){
            return null;
        }
        TraceThreadPoolTaskExecutor traceThreadPoolTaskExecutor = traceThreadPoolTaskExecutorMap.get(code);
        return traceThreadPoolTaskExecutor;
    }


    public void put(String threadCode, TraceThreadPoolTaskExecutor threadPoolTaskExecutor) {
        traceThreadPoolTaskExecutorMap.put(threadCode, threadPoolTaskExecutor);
    }
}
